#include "StdAfx.h"
#include "AdaptateurPDF.h"


AdaptateurPDF::AdaptateurPDF(CPDF * cpdf) : _cpdf(cpdf)
{
	maxX = cpdf->GetDocumentWidth();
	maxY = cpdf->GetDocumentHeight();
}


AdaptateurPDF::~AdaptateurPDF(void)
{
}


void AdaptateurPDF::PrintRepere(const unsigned nbMachine, const unsigned tempsMax) {
	if ( (maxX*nbMachine)/tempsMax > maxY)
		maxY = (maxX*nbMachine)/tempsMax;
	else if ( (maxY*tempsMax)/nbMachine > maxX)
		maxX = (maxY*tempsMax)/nbMachine;

	unsigned stepX = maxX / tempsMax;
	unsigned stepY = maxY / (nbMachine+1);
	
	for (int i = 0; i < nbMachine; i++){
		stringstream ss;
		ss<< "M" << i+1;
		
		_cpdf->Text(5,(1+i)*stepY+stepY/3,ss.str().c_str());
	}
}

void AdaptateurPDF::Print(const JobPlanifie & JP) const{
	
}

void AdaptateurPDF::Print (const vector<JobPlanifie> vj) const{
	for (int i = 0 ; i < vj.size() ; i++) {
		Print(vj.at(i));
	}
}